<?php echo $this->load->view('meta'); ?>
<link rel="stylesheet" href="<?=base_url()?>css/admin.css" type="text/css" media="screen" />
<title>xa-ncsu | admin - news</title>
<link rel="stylesheet" href="<?=base_url()?>css/impromptu.css" type="text/css" media="screen" />
<script type="text/javascript" src="<?=base_url();?>js/jquery-impromptu.1.2.js"></script>
<script>
function vhconfirm(v,m)
        {
            if( v )
            {
                var f =  document.createElement("form");document.body.appendChild(f);f.method = "POST";f.action = $("#" + v ).attr( "href" );f.submit();
            } else
            {
                return false;
            }
        }
</script>
<?php echo $this->load->view('header'); ?>
<h3>Announcements</h3>
<p><?=anchor('news', 'view announcements');?> | <?=anchor('news/publish', 'create announcement');?></p>
<?php if ($announcements->num_rows() > 0): ?>
<table>
<tr>
	<th>title</th>
	<th>author</th>
	<th>published</th>
	<th>expires</th>
	<th>actions</th>
</tr>
<?php foreach ($announcements->result() as $row) : ?>
<tr>
	<td><?=$row->title?></td>
	<td><?=$row->author?></td>
	<td><?=date( 'M d, y', $row->created);?></td>
	<td><?php if ($row->expires != '0') { echo date( 'M d, y', $row->expires); } else { echo 'Never'; } ?></td>
	<td><a href="<?=site_url();?>news/editAnnouncement/<?=$row->id?>"><img src="<?=base_url();?>img/icons/page_edit.png" alt="Edit Announcement" title="Edit Announcement" /></a>
		<a href="<?=site_url();?>news/deleteAnnouncement/<?=$row->id?>" id="conf<?=$row->id?>" onclick="$.prompt('Delete Announcement?',{callback: vhconfirm, buttons: { Yes : 'conf<?=$row->id?>', No : false}}); return false;">
			<img src="<?=base_url();?>img/icons/delete.png" alt="Delete Announcement" title="Delete Announcement" /></a>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php else: ?>
<p>No announcements.</p>
<?php endif; ?>
<?php echo $this->load->view('footer'); ?>